<%--
  Created by IntelliJ IDEA.
  User: kgy
--%>
<%@ page contentType="text/html; charset=UTF-8" language="java" %>
<!-- 头部导航栏 -->
<nav class="bg-white  shadow-sm  sticky-top">
    <div class="container">
        <div class="row">
            <div class="col">
                <nav class="navbar p-3 navbar-expand-lg navbar-light">
                    <a class="navbar-brand" href="#">
                        <!-- 头部logo -->
                        <img src="/upload/images/logo3.png" class="img-fluid" style="max-width:80px;" alt="logo">
                    </a>
                    <button class="navbar-toggler" type="button" data-toggle="collapse"
                            data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
                            aria-expanded="false" aria-label="Toggle navigation">
                        <span class="navbar-toggler-icon"></span>
                    </button>
                    <div class="collapse navbar-collapse" id="navbarSupportedContent">
                        <ul class="navbar-nav mr-auto">
                            <li class="nav-item ${url == null ? 'active' : ''}">
                                <a class="nav-link" href="../../index.jsp">首页</a>
                            </li>
                            <li class="nav-item ${url == '/cooperation/selectAll?currentPageIndex=' ? 'active' : ''} ${url == '/cooperation/selectByCid?' ? 'active' : ''}">
                                <a class="nav-link" href="/cooperation/cooperationSquare">组队广场</a>
                            </li>
                            <li class="nav-item ${url == '/activity/selectAll?currentPageIndex=' ? 'active' : ''} ${url == '/activity/selectActivities?' ? 'active' : ''}">
                                <a class="nav-link" href="/activity/activitySquare">
                                    活动广场
                                </a>
                            </li>
                        </ul>
                        <!-- 登陆后 -->
                        <shiro:authenticated>
                            <ul class="navbar-nav ml-md-auto">
                                <li class="nav-item dropdown">
                                    <a class="btn btn-outline-primary nav-item  dropdown-toggle mr-md-2" href="#"
                                       id="bd-versions" data-toggle="dropdown" aria-haspopup="true"
                                       aria-expanded="false">
                                        发起
                                        <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-cursor"
                                             fill="currentColor" xmlns="http://www.w3.org/2000/svg">
                                            <path fill-rule="evenodd"
                                                  d="M14.082 2.182a.5.5 0 0 1 .103.557L8.528 15.467a.5.5 0 0 1-.917-.007L5.57 10.694.803 8.652a.5.5 0 0 1-.006-.916l12.728-5.657a.5.5 0 0 1 .556.103zM2.25 8.184l3.897 1.67a.5.5 0 0 1 .262.263l1.67 3.897L12.743 3.52 2.25 8.184z"/>
                                        </svg>
                                    </a>
                                    <div class="dropdown-menu dropdown-menu-md-right" aria-labelledby="bd-versions">
                                        <shiro:hasRole name="user">
                                            <a class="dropdown-item " href="/cooperation/prePublish">发起组队</a>
                                        </shiro:hasRole>
                                        <shiro:hasRole name="association">
                                            <a class="dropdown-item " href="/activity/publishActivity">发起活动</a>
                                        </shiro:hasRole>
                                    </div>
                                </li>
                                <li class="nav-item">
                                    <a class="btn btn-primary nav-item" href="/message/list">
                                        消息<span id="unreadnum" class="badge badge-light ml-2">${unreadmessage}</span>
                                        <span class="sr-only">unread messages</span>
                                    </a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-item  dropdown-toggle mr-md-2" href="#" id="my" data-toggle="dropdown"
                                       aria-haspopup="true" aria-expanded="false">
                                        <!-- 用户头像 -->
                                        <img class="img-fluid rounded-circle pl-2 ml-1" src="${photo}"
                                             style="width: 62px;height: 46px;padding-right: 8px;margin-right: 0px;">
                                    </a>
                                    <div class="dropdown-menu dropdown-menu-md-right" aria-labelledby="my">
                                        <a class="dropdown-item " href="/user/${sessionScope.uid}">我的卡片</a>
                                        <a class="dropdown-item " href="/user/update">个人中心</a>
                                        <div class="dropdown-divider"></div>
                                        <a class="dropdown-item" href="/logout">退出登陆</a>
                                    </div>
                                </li>
                            </ul>
                        </shiro:authenticated>
                        <shiro:guest>
                            <!-- 游客 -->
                            <ul class="navbar-nav ml-md-auto">
                                <li class="nav-item">
                                    <a class="btn btn-primary nav-item" href="/login">
                                        登陆
                                    </a>
                                </li>
                                <li class="nav-item ml-2">
                                    <a class="btn btn-primary nav-item" href="/register">
                                        注册
                                    </a>
                                </li>
                            </ul>
                        </shiro:guest>
                    </div>
                </nav>
            </div>
        </div>
    </div>
</nav>